On Error Resume Next
 
Dim installPath 
Dim addInName 
Dim addInFileName 
Dim objExcel 
Dim objAddin
 
'设定AddIns情报
addInName = "myEtExtends Addin" 
addInFileName = "myEtExtends.xlam"
 
IF MsgBox("Do you want to uninstall " &addInName & " ?", vbYesNo + vbQuestion, addInName) = vbNo Then 
  WScript.Quit 
End IF
 
'Excel 实例化
Set objExcel = CreateObject("Excel.Application") 
objExcel.Workbooks.Add
 
'AddIns解除注册
For i = 1 To objExcel.Addins.Count 
  Set objAddin = objExcel.Addins.item(i) 
  If objAddin.Name = addInFileName Then 
    objAddin.Installed = False 
  End If 
Next
 
'Excel 退出
objExcel.Quit
 
Set objAddin = Nothing 
Set objExcel = Nothing
 
Set objWshShell = CreateObject("WScript.Shell") 
Set objFileSys = CreateObject("Scripting.FileSystemObject")
 
'创建卸载路径
'(ex)C:\Users\[User]\AppData\Roaming\Microsoft\AddIns\[addInFileName] 
installPath = objWshShell.SpecialFolders("Appdata") & "\Microsoft\Addins\" & addInFileName
 
'删除文件
If objFileSys.FileExists(installPath) = True Then 
  objFileSys.DeleteFile installPath , True 
Else 
  MsgBox "Add-in file does not exist.", vbExclamation, addInName  
End If
 
'删除注册表
'objWshShell.RegDelete("HKCU\Software\VB and VBA Program Settings\url_to_pic\")
 
'Set objWshShell = Nothing 
'Set objFileSys = Nothing
 
IF Err.Number = 0 THEN 
   MsgBox "The add-ins have been uninstalled.", vbInformation, addInName 
ELSE 
   MsgBox "An error has occurred." & vbCrLF & "If Excel is running, exit it.", vbExclamation, addInName 
End IF